package api

import (
	"net/http"
	"hytx_media/pkg/app"
	"hytx_media/pkg/e"
		"hytx_media/pkg/upload"

	"github.com/gin-gonic/gin"
				)

// @Summary 上传图片
// @Produce  json
// @Param image post file true "图片文件"
// @Success 200 {string} json "{"code":200,"data":{"image_save_url":"upload/images/96a.jpg", "image_url": "http://..."}"
// @Router /api/v1/tags/import [post]
func UploadImage(c *gin.Context) {
	appG := app.Gin{C: c}

	img := upload.Image(c)
	if img["code"] != 200 {
		c.JSON(img["code"].(int), img)
		return
	}
	appG.Response(http.StatusOK, e.SUCCESS, map[string]string{
		"image_url":      upload.GetImageFullUrl(img["data"].(string)),
		//"image_save_url": savePath + imageName,
	})
}
